#include "SemanticNodeBlockTerminate.h"

/**
 *  @fn	SemanticNodeBlockTerminate::SemanticNodeBlockTerminate(const SyntaxTreeNode *terminateNodeP
 *  	arent, SemanticNode *parent)
 * 
 *  @brief	Constructor. 
 * 
 *  @author	Nikola Novak
 *  @date	6/23/2009
 * 
 *  @param	terminateNodeParent	If non-null, the terminate node parent.
 *  @param	parent				If non-null, the parent.
 */
SemanticNodeBlockTerminate::SemanticNodeBlockTerminate(const SyntaxTreeNode *terminateNodeParent, SemanticNode *parent) : SemanticNode(parent), LabeledNode(terminateNodeParent->Nodes->GetData(0)) {
	terminateExpression = NULL;
}
/**
 *  @fn	void SemanticNodeBlockTerminate::setExpression(SemanticNodeExpression *termination)
 * 
 *  @brief	Sets an expression. 
 * 
 *  @author	Nikola Novak
 *  @date	6/23/2009
 * 
 *  @param	termination	If non-null, the termination.
 */
void SemanticNodeBlockTerminate::setExpression(SemanticNodeExpression *termination) {
	terminateExpression = termination;
}
/**
 *  @fn	std::string SemanticNodeBlockTerminate::toDebugString(int tab)
 * 
 *  @brief	Converts a tab to a debug string. 
 * 
 *  @author	Nikola Novak
 *  @date	6/23/2009
 * 
 *  @param	tab	The tab.
 * 
 *  @return	This object as a std::string.
 */
std::string SemanticNodeBlockTerminate::toDebugString(int tab) {
	std::ostringstream res;
	for (int i = 0; i < tab; i++) res << DEBUG_STRING_RAZMAK;
	res << getLabelsDebugString() << ": terminate" << std::endl;
	if (terminateExpression != NULL) res << ((SemanticNode *)(terminateExpression))->toDebugString(tab + 1);
	return res.str();
}
